﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApp.Model;
using WindowsFormsApp.Views;

namespace WindowsFormsApp
{
    public partial class MainForm : AntdUI.Window
    {

        public MainForm()
        {
            InitializeComponent();
            initMenu();
            initView();

        }
        private void initMenu()
        {
            
           

        }
        private MainView mainView;
        private DashboardView dataView;
        private SettingsView settingsView;
        private void initView()
        {
            mainView = new MainView();
            dataView = new DashboardView();
            settingsView = new SettingsView();
            viewPanel.Controls.Clear();
            viewPanel.Controls.Add(mainView);
            viewPanel.Controls.Add(dataView);
            viewPanel.Controls.Add(settingsView);
            mainView.Dock = DockStyle.Fill;
            dataView.Dock = DockStyle.Fill;
            settingsView.Dock = DockStyle.Fill;
            mainView.Visible = true;
            dataView.Visible = false; 
            settingsView.Visible = false;

         

            btnMain.ImageSvg = Resource1.main;
            btnMain.ImageSize = new Size(30, 30);
            btnDashboard.ImageSvg = Resource1.data;
            btnDashboard.ImageSize = new Size(30, 30);
            btnSettings.ImageSvg = Resource1.settings;
            btnSettings.ImageSize = new Size(30, 30);

            var width = menuFlowPanel.Width - 5;
            var height = 60;
            btnMain.Size = new Size(width, height);
            btnDashboard.Size = new Size(width, height);
            btnSettings.Size = new Size(width, height);


            btnMain.Click += BtnMain_Click;
            btnDashboard.Click += BtnDashboard_Click;
            btnSettings.Click += BtnSettings_Click;
            
        }

        private void BtnSettings_Click(object sender, EventArgs e)
        {
            showSettingsView();
        }

        private void BtnDashboard_Click(object sender, EventArgs e)
        {
            showDataView();
        }

        private void BtnMain_Click(object sender, EventArgs e)
        {
            showMainView();
        }

        
        private void showMainView()
        {
            mainView.Visible = true;
            dataView.Visible = false;
            settingsView.Visible = false;
        }
        private void showDataView()
        {
            mainView.Visible = false;
            dataView.Visible = true;
            settingsView.Visible = false;
        }
        private void showSettingsView()
        {
            mainView.Visible = false;
            dataView.Visible = false;
            settingsView.Visible = true;

        }

        
    }
}
